home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
spxcon.arc
/
MYALLOC.C
< prev
Wrap
Text File
|
1987-12-01
|
927b
|
48 lines
/*****************************************************************************
*
* Program Name: CONNECT
*
* Filename: myalloc.c
*
* Date Created: December 1, 1987
*
* Programmers: Bryan Sparks
* Software Consultant
* API Consulting
* Novell Inc.
*
* Files used: connect.c
*
* Comments:
* This is an alloc program taken mostly from Kernighan & Ritchie.
*
****************************************************************************/
#define ALLOCSIZE 7000
char allocbuf[ALLOCSIZE];
char *allocp = allocbuf;
char *myalloc(n, size)
int n;
int size;
{
int numberOfBytes;
numberOfBytes = n*size;
if ( allocp + numberOfBytes <= allocbuf + ALLOCSIZE ) {
allocp += numberOfBytes;
return ( allocp - numberOfBytes );
}
else
return (0);
}
myfree(p)
char *p;
{
if ( p >= allocbuf && p < allocbuf + ALLOCSIZE )
allocp = p;
}